package com.oromwin.repos.server.response;

import java.io.DataInputStream;
import java.io.IOException;

import org.apache.commons.logging.Log;

import com.oromwin.repos.common.Logger;
import com.oromwin.repos.common.ReposException;
import com.oromwin.repos.common.helper.IOHelper;

public class CreateResponse extends NormalResponse {
    private Log log = Logger.getLog(CreateResponse.class);
    private String ObjectId = null;
    
    public CreateResponse() {
    }

    public CreateResponse(boolean result, String description, String fileId) {
        Result = result;
        Description = description;
        ObjectId = fileId;
    }

    public void receive(DataInputStream dis) throws ReposException {
        try {
            Result = dis.readBoolean();
            Description = IOHelper.readUTF8(dis);
            ObjectId = IOHelper.readUTF8(dis);
        } catch (IOException e) {
            throw ReposException.create(log, e);
        }
    }

    public String getObjectId() {
        return ObjectId;
    }
}
